package co.yixiang.yshop.module.product.controller.admin.productcoupon.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "管理后台 - 商品优惠券创建 Request VO")
@Data
@ToString(callSuper = true)
public class ProductCouponCreateReqVO {

    @Schema(description = "优惠券名称", required = true, example = "1")
    @NotBlank(message = "优惠券名称不能为空")
    private String couponName;

    @Schema(description = "优惠券面值", required = true, example = "1")
    private BigDecimal couponValue;

    @Schema(description = "优惠券类型：1、满减券，2、折扣券", required = true, example = "1")
    @NotNull(message = "优惠券类型不能为空")
    private Integer couponType;

    @Schema(description = "满减门槛", required = true, example = "1")
    private BigDecimal threshold;

    @Schema(description = "折扣", required = true, example = "1")
    private BigDecimal discount;

    @Schema(description = "优惠券范围：1、所有商品，2、选中商品可用，3、选中商品不可用", required = true, example = "1")
    @NotNull(message = "优惠券范围类型不能为空")
    private Integer couponScope;

    @Schema(description = "范围值", required = true, example = "1")
    private String[] ids;

    @Schema(description = "优惠券发放数量", required = true, example = "1")
    @NotNull(message = "优惠券方法数量不能为空")
    private Long totalNumber;

    @Schema(description = "领取限制类型 1 无限制 2限制次数", required = true, example = "1")
    @NotNull(message = "领取限制类型不能为空")
    private Integer receiveType;

    @Schema(description = "限制每人领取数量", required = true, example = "1")
    private Long limitNumber;

    @Schema(description = "过期类型：1、按时间，2、按天数，3、无时间限制", required = true, example = "1")
    @NotNull(message = "过期类型不能为空")
    private Integer expirationType;

    @Schema(description = "生效时间", required = true, example = "1")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime takingEffectTime;

    @Schema(description = "过期时间", required = true, example = "1")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime expirationTime;

    @Schema(description = "过期天数", required = true, example = "1")
    private Long expirationDay;

    @Schema(description = "备注", required = true, example = "1")
    private String remark;

    @Schema(description = "兑换类型：0：页面领取，1：通用码，2：一券一码", required = true, example = "1")
    @NotNull(message = "优惠券兑换类型不能为空！")
    private Integer getType;

    @Schema(description = "兑换码，兑换类型为1时需要填写", required = true, example = "1")
    private String cdkey;
}
